<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        // $this->call(UsersTableSeeder::class);
        //填充默认admin用户名
        DB::table('admin_users')->insert([
            'name' => 'admin',
            'nickname' => '超级管理员',
            'email' => str_random(10).'@admin.com',
            'avatar' => '/xx/xx/xx.jpg',
            'password' =>  md5(md5('admin')),
            'introduction' => '这是超级管理员账号',
        ]);

        //添冲默认权限
        DB::table('admin_permissions')->insert([
            [
                'name' => '管理员管理',
                'rule' => 'admin-admin-admin',
                'pid' => 0,
                'is_menu' => '1',
                'icon' => '',
                'sort' => '0',
            ],
            [
                'name' => '管理员列表',
                'rule' => 'admin-admin-index',
                'pid' => 1,
                'is_menu' => '1',
                'icon' => '',
                'sort' => '0',
            ],
            [
                'name' => '角色管理',
                'rule' => 'admin-role-index',
                'pid' => 1,
                'is_menu' => '1',
                'icon' => '',
                'sort' => '0',
            ],
            [
                'name' => '权限管理',
                'rule' => 'admin-permission-index',
                'pid' => 1,
                'is_menu' => '1',
                'icon' => '',
                'sort' => '0',
            ],
            [
                'name' => '首页',
                'rule' => 'admin-index-index',
                'pid' => 0,
                'is_menu' => '',
                'icon' => '',
                'sort' => '0',
            ],
            [
                'name' => '欢迎页',
                'rule' => 'admin-index-welcome',
                'pid' => 0,
                'is_menu' => '0',
                'icon' => '',
                'sort' => '0',
            ]
        ]);

    }
}
